﻿using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net;
using System.Resources;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;


//synchronization signals delay measurement device

namespace monitor_server_2_WPF
{
    class Res
    {
        public interface IControlForMainWindow
        {
            UIElement GetControl(out MainWindow.HidingDelegate del);
        }

        //public delegate void HidingDelegate();
        //public delegate void AuthorizedDelegate();
        //public delegate void UnauthorizedDelegate();

        public static string IpMask = "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}";

        public static Brush MouseOverBrush = new SolidColorBrush(Colors.White) { Opacity = 0.15 };
        public static Color LighBlack = Color.FromArgb(255, 45, 45, 48);
        public static Color NiceBlue = Color.FromArgb(0xFF, 0x00, 0x7A, 0xCC);
        public static Color LoginGreen = Colors.LawnGreen;
        public static Color WarningOrange = Color.FromArgb(0xFF, 0xCA, 0x51, 0x00);
        public static Color InvalidInputInfoColor = Colors.DarkOrange;
        //public static Color NiceBlue = Colors.DodgerBlue;

        public static ResourceManager Rm = new ResourceManager(typeof(monitor_server_2_WPF_r));

        public static BitmapImage GetBitMapFromPng(string resName)
        {
            var bi = new BitmapImage();
            var dimg = (System.Drawing.Image)Rm.GetObject(resName);
            var mr = new MemoryStream();
            dimg.Save(mr, ImageFormat.Png);
            mr.Position = 0;
            bi.BeginInit();
            bi.StreamSource = mr;
            bi.EndInit();
            return bi;
        }

        public static void MessageBox(string text, string caption = "",
                                      MessageBoxButton messageBoxButton = MessageBoxButton.OK, MessageBoxImage boxImage = MessageBoxImage.None)
        {
            
        }

        public static bool IpCheck(string ipString)
        {
            IPAddress ip;
            return !(!IPAddress.TryParse(ipString, out ip) || !Regex.IsMatch(ipString, IpMask));
        }
    }
}
